package com.ecfront.dao.impl;

import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.ecfront.dao.ReplyDAO;
import com.ecfront.pojo.Reply;


/**
 * @version 1.0
 * @author www.ecfrom.com
 */

public class ReplyDAOImpl extends HibernateDaoSupport implements ReplyDAO {

	protected void initDao() {}

	public void save(Reply transientInstance) {
		getHibernateTemplate().save(transientInstance);
	}

	public void delete(Reply persistentInstance) {
		getHibernateTemplate().delete(persistentInstance);
	}


	public Reply findById(java.lang.Integer id) {
		Reply instance = (Reply) getHibernateTemplate().get(
					"com.ecfront.pojo.Reply", id);
		return instance;
	}


	public List findByExample(Reply instance) {
		List results = getHibernateTemplate().findByExample(instance);

		return results;
	}


	public List findByProperty(String propertyName, Object value) {
		String queryString = "from Reply as model where model."
					+ propertyName + "= ?";
		return getHibernateTemplate().find(queryString, value);
	}


	public List findByRcontent(Object rcontent) {
		return findByProperty(RCONTENT, rcontent);
	}

	public List findAll() {
		String queryString = "from Reply";
		return getHibernateTemplate().find(queryString);
	}

	public static ReplyDAO getFromApplicationContext(ApplicationContext ctx) {
		return (ReplyDAO) ctx.getBean("ReplyDAO");
	}
}